package com.example.demo.entity;

import com.example.demo.listener.AccountCryptListener;
import com.example.demo.listener.AccountDictListener;
import com.example.demo.listener.AccountPermissionListener;
import com.mybatisflex.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
//import lombok.NoArgsConstructor;
import lombok.experimental.Tolerate;

import java.util.Date;
import java.util.List;

@Data
//@NoArgsConstructor
@AllArgsConstructor
@Builder
@Table(value = "tb_account",
        onSet = {AccountPermissionListener.class,
                AccountCryptListener.class,
                AccountDictListener.class}) // 权限监听器
public class Account {
    // @NoArgsConstructor 要的话标红
    @Tolerate
    public Account() {
        // SuppressWarnings
    }

//    @ColumnAlias("account_id")
    @Id(keyType = KeyType.Auto)
    private Long id;
    private String userName;
    private String password;
    private Integer age;
    // 后来加的
    private Integer gender;
    private Date birthday;

    @Column(ignore = true) // 不是数据库字段 ，忽略
    private String genderName;
    // 数据库没有这个字段，List 默认是忽略的
    private List<Order> orderList;

}